Debug mode for unordered_multimap. Some mods were done for unordered_map as well to keep all the tests passing. However unordered_map is at the very least still missing tests, if not functionality (if it isn't tested, it probably isn't working). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187446 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/unordered_map b/include/unordered_map index 55db2f5..eebf2f5 100644 --- a/include/unordered_map +++ b/include/unordered_map 
@@ -801,8 +801,18 @@    template <class... _Args>  _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator emplace_hint(const_iterator __p, _Args&&... __args) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" + " referring to this unordered_map"); + return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; + } +#else  iterator emplace_hint(const_iterator, _Args&&... __args)  {return emplace(_VSTD::forward<_Args>(__args)...).first;} +#endif  #endif // _LIBCPP_HAS_NO_VARIADICS  #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES  _LIBCPP_INLINE_VISIBILITY @@ -816,14 +826,34 @@  {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));}  #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES  _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, const value_type& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" + " referring to this unordered_map"); + return insert(__x).first; + } +#else  iterator insert(const_iterator, const value_type& __x)  {return insert(__x).first;} +#endif  #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES  template <class _Pp,  class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>  _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, _Pp&& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" + " referring to this unordered_map"); + return insert(_VSTD::forward<_Pp>(__x)).first; + } +#else  iterator insert(const_iterator, _Pp&& __x)  {return insert(_VSTD::forward<_Pp>(__x)).first;} +#endif  #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES  template <class _InputIterator>  void insert(_InputIterator __first, _InputIterator __last); @@ -1047,6 +1077,7 @@  {  #if _LIBCPP_DEBUG_LEVEL >= 2  __get_db()->__insert_c(this); + __get_db()->swap(this, &__u);  #endif  }   @@ -1066,6 +1097,10 @@  _VSTD::move(__u.__table_.remove((__i++).__i_)->__value_)  );  } +#if _LIBCPP_DEBUG_LEVEL >= 2 + else + __get_db()->swap(this, &__u); +#endif  }    #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1754,6 +1789,7 @@  {  #if _LIBCPP_DEBUG_LEVEL >= 2  __get_db()->__insert_c(this); + __get_db()->swap(this, &__u);  #endif  }   @@ -1775,6 +1811,10 @@  );  }  } +#if _LIBCPP_DEBUG_LEVEL >= 2 + else + __get_db()->swap(this, &__u); +#endif  }    #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES